package com.example.opengl;

import java.util.ArrayList;
import java.util.List;

import android.app.ListActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.example.opengl.KText2D.KText2DActivity;
import com.example.opengl.ktexttest.Text2DActivity;
import com.example.opengl.square.BouncySquareActivity;

public class OpenGLList extends ListActivity {

    KLog kLog = new KLog("OpenGLList");

    Context mConText;

    List<String> nameList = new ArrayList<String>();

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        kLog.i("OpenGLList - onCreate");

        mConText = this; 

        nameList.add("2D Square");
        nameList.add("Text 2D");
        setListAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, nameList));
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        kLog.i("OpenGLList - onActivityResult");
        super.onActivityResult(requestCode, resultCode, data);
    }

    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {

        if (position == 0) {
            Intent intent = new Intent(mConText, BouncySquareActivity.class);
            startActivity(intent);
        } else if (position == 1) {
            Intent intent = new Intent(mConText, Text2DActivity.class);
            startActivity(intent);
        } else if (position == 2) {
            Intent intent = new Intent(mConText, Text2DActivity.class);
            startActivity(intent);
        }
    }

    @Override
    protected void onPause() {
        kLog.i("Trim List - onPause");
        super.onPause();
    }

    @Override
    protected void onRestart() {
        kLog.i("Trim List - onRestart");
        super.onRestart();
    }

    @Override
    protected void onResume() {
        kLog.i("Trim List - onResume");
        super.onResume();
    }

    @Override
    protected void onStart() {
        kLog.i("Trim List - onStart");
        super.onStart();
    }

    @Override
    protected void onStop() {
        kLog.i("Trim List - onStop");
        super.onStop();
    }
}
